/**
 * 
 */
package com.evon.yardmanagement.ui.action;


import java.util.ArrayList;
import java.util.List;

import com.evon.yardmanagement.model.Yard;
import com.evon.yardmanagement.model.Yard;
import com.evon.yardmanagement.service.YardManagementService;
import com.evon.yardmanagement.transformer.YardTransformer;
import com.evon.yardmanagement.ui.dto.YardDTO;
import com.opensymphony.xwork2.ActionSupport;

/**
 * @author Sandeep
 *
 */
public class AddYardAction extends ActionSupport {
	private Integer yardId;
	private String yardName;
	private String yardCity;
	private String yardAddress;
	private String yardPhone;
	public String execute() throws Exception {
		YardDTO yardDto = new YardDTO();
		//Yard yard = YardTransformer.transformCreateYard(yardDto);
		Yard yard = new Yard(); 
		yard.setId(getYardId());
		yard.setName(getYardName());
		yard.setCity(getYardCity());
		yard.setAddress(getYardAddress());
		yard.setPhone(getYardPhone());
		YardManagementService service = new YardManagementService();
		boolean isYardAdded = service.addYard(yard);
		return SUCCESS;
	}
	
	public Integer getYardId() {
		return yardId;
	}



	public void setYardId(Integer yardId) {
		this.yardId = yardId;
	}

	public String getYardName() {
		return yardName;
	}
	public void setYardName(String yardName) {
		this.yardName = yardName;
	}
	public String getYardPhone() {
		return yardPhone;
	}
	public void setYardPhone(String yardPhone) {
		this.yardPhone = yardPhone;
	}
	public String getYardCity() {
		return yardCity;
	}

	public void setYardCity(String yardCity) {
		this.yardCity = yardCity;
	}

	public String getYardAddress() {
		return yardAddress;
	}

	public void setYardAddress(String yardAddress) {
		this.yardAddress = yardAddress;
	}
}
